package org.hawk.gwtppc.webtest.tests.classsuite;

import java.lang.reflect.Modifier;
import java.util.Arrays;

import org.hawk.gwtppc.webtest.common.Asserts;
import org.hawk.gwtppc.webtest.common.Test;
import org.hawk.gwtppc.webtest.tests.mock.SubClassMock1;

public class GetFieldsTest implements Test {

	public void run() throws Throwable {
		Asserts.assertEquals(SubClassMock1.class.getFields().length, 3, "Expected array of length 3 bug got: " +
					Arrays.toString(SubClassMock1.class.getFields()));
		
		Asserts.assertEquals(SubClassMock1.class.getFields()[0].getName(), "flag");
		Asserts.assertEquals(SubClassMock1.class.getFields()[0].getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock1.class.getFields()[0].getType(), boolean.class);
		
		Asserts.assertEquals(SubClassMock1.class.getFields()[1].getName(), "switcher");
		Asserts.assertEquals(SubClassMock1.class.getFields()[1].getModifiers(), Modifier.PUBLIC | Modifier.STATIC);
		Asserts.assertEquals(SubClassMock1.class.getFields()[1].getType(), boolean.class);
		
		Asserts.assertEquals(SubClassMock1.class.getFields()[2].getName(), "values");
		Asserts.assertEquals(SubClassMock1.class.getFields()[2].getModifiers(), Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL);
		Asserts.assertEquals(SubClassMock1.class.getFields()[2].getType(), String[].class);
	}

	public String getName() {
		return "getFields()";
	}

}
